package com.data.deal.util;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Paths;
import java.util.Arrays;

public class CodeGenerator {
    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:postgresql://47.84.62.117:15432/ghost_sa", "postgres", "Postgres123..")
                .globalConfig(builder -> builder
                        .author("jww")
                        .outputDir(Paths.get(System.getProperty("user.dir")) + "/src/main/java/codecenerator")
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.baomidou.mybatisplus")
                        .entity("entity")
                        .mapper("mapper")
                        .service("service")
                        .serviceImpl("service.impl")
                        .xml("mapper.xml")
                )
                .strategyConfig(builder -> builder
                        .addInclude(Arrays.asList("ghost_sa_pro_all_json"))
                        .entityBuilder()
                        .enableLombok()

                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }
}
